package com.foreknow.practice.demo16;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class CopyFile {
    public static void main(String[] args) {

        try {
            //输入
            FileReader fis = new FileReader("map遍历.png");
            //输出
            FileWriter fos = new FileWriter("new.png");
            //读取
            int read =fis.read();
            while (read!=-1){
                //将读取到的字节写到输出里面
                fos.write(read);
                read=fis.read();

            }
            //释放资源
            fos.close();
            fos.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
